from pydantic import BaseModel, ConfigDict, Field
from pydantic_settings import BaseSettings

from common.rpc import stub
from common.utils import logger, tracing

class LlmConf(BaseModel):
    api_key_name: str = Field(alias="ApiKeyName")
    api_key: str = Field(alias="ApiKey")
    model: str = Field(alias="Model")
    model_provider: str = Field(alias="ModelProvider")

class Config(BaseSettings):
    model_config = ConfigDict(extra="ignore")
    
    name: str = Field(alias="Name")
    listen_on: str = Field(alias="ListenOn")
    max_workers: int = Field(alias="MaxWorkers", default=10)
    
    log: logger.LogConf = Field(alias="Log")
    
    llm_conf: LlmConf = Field(alias="LlmConf")
    assistant_rpc_conf: stub.RpcStubConfig = Field(alias="AssistantRpcConf")
    telemetry_conf: tracing.TelemetryConf = Field(alias="Telemetry")